﻿using System.Numerics;
/// <summary>
/// https://leetcode-cn.com/problems/unique-paths/
/// </summary>
public class Solution
{
    private BigInteger C(BigInteger n, BigInteger m)
    {
        BigInteger result = BigInteger.One;
        for (BigInteger i = n; i > m; i--)
            result *= i;
        for (BigInteger i = n - m; i > BigInteger.One; i--)
            result /= i;
        return result;
    }
    public int UniquePaths(int m, int n)
    {
        return (int)this.C(m + n - 2, m - 1);
    }
}